package com.VitalFit.mapper;


import com.VitalFit.model.entity.Appointment;
import com.VitalFit.model.entity.Customer;
import com.VitalFit.model.entity.Trainer;
import com.VitalFit.model.dto.AppointmentDTO;
import com.VitalFit.model.vo.AppointmentVO;
import org.mapstruct.Context;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

@Mapper
public interface AppointmentMapper {

    AppointmentMapper INSTANCE = Mappers.getMapper(AppointmentMapper.class);

    @Mapping(target = "customer", expression = "java(customer)")
    @Mapping(target = "trainer", expression = "java(trainer)")
    Appointment appointmentDTOToAppointment(AppointmentDTO appointmentDTO, @Context Customer customer,
                                            @Context Trainer trainer);


    @Mapping(target = "trainerName", expression = "java(trainer.getName())")
    AppointmentVO appointmentToAppointmentVO(Appointment appointment,@Context Trainer trainer);

}
